#pragma once
#include <memory>
#include <vector>
#include <glm/glm.hpp>
#include <glm/fwd.hpp>
#include <glm/gtc/matrix_transform.hpp>

class Object {
public:
    Object() = default;
    virtual ~Object() = default;

    Object(const Object &) = delete;
    Object &operator=(const Object &) = delete;
    Object(Object &&) = default;
    Object &operator=(Object &&) = default;
    static std::unique_ptr<Object> create();

    Object *addChild(std::unique_ptr<Object> child) {
        auto ptr = const_cast<Object *>(child.get());
        child->parent = this;
        m_children.emplace_back(std::move(child));
    }
    // size_t findChild(const Object *child) {}
    void removeChild(Object *child);

    virtual void update(float dt) {
        for (auto &child : m_children) child->update(dt);
    }

private:
    Object *parent{nullptr};
    std::vector<std::unique_ptr<Object>> m_children{};
};